/**
 * Created by IntelliJ IDEA
 *
 * @author zhengjie
 * @Date:2022/1/8 11:46
 * @Version 1.0
 */
package com.zj.ssm.controller;

import com.zj.ssm.aop.Log;
import com.zj.ssm.pojo.domain.DepartmentDetails;
import com.zj.ssm.pojo.domain.vo.DepartmentVO;
import com.zj.ssm.result.AjaxResult;
import com.zj.ssm.service.DepartmentService;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("department")
public class DepartmentController {

    @Autowired
    public DepartmentService departmentService;

    @RequestMapping("list")
    public AjaxResult list(){
        return departmentService.list();
    }

    @RequestMapping("liststate")
    public AjaxResult liststate(){
        return departmentService.liststate();
    }

    @RequestMapping("get/{id}")
    public AjaxResult getdep(@PathVariable("id") Integer id){
        return departmentService.getdep(id);
    }

    @RequestMapping("update")
    @Log("修改科室")
    public AjaxResult updatedep(DepartmentVO departmentVO){
        return departmentService.updatedep(departmentVO);
    }

    @RequestMapping("add")
    @Log("添加科室")
    public AjaxResult adddep(DepartmentVO departmentVO){
        return departmentService.adddep(departmentVO);
    }

    @RequestMapping("query")
    public AjaxResult querydep(){
        return departmentService.querydep();
    }

    @RequestMapping("updateDepart/{id}")
    public AjaxResult updateDepart(@PathVariable("id")Integer id){
        return departmentService.updateDepart(id);
    }

    @RequestMapping("departUpdate/{id}")
    public AjaxResult departUpdate(@PathVariable("id")Integer id){
        return departmentService.departUpdate(id);
    }

    @RequestMapping("listDetails")
    public AjaxResult listDetails(Integer id){
        return departmentService.listDetails(id);
    }

    @RequestMapping("updateDetails")
    @Log("修改科室详情")
    public AjaxResult updateDetails(DepartmentDetails departmentDetails){
        return departmentService.updateDetails(departmentDetails);
    }


}
